package com.yxx.sys.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.codehaus.jackson.annotate.JsonProperty;
import sun.reflect.generics.tree.Tree;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: YuXinXin
 * @Description:
 * @Date:Created in 21:34 2020/8/13
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TreeNode {

  private Integer id;
//  @JsonProperty(value = "parentId")
  private Integer parentId;
  private String title;
  private String icon;
  private String href;
  private Boolean spread;
  private List<TreeNode> children=new ArrayList<>();

  private String checkArr="0";//是否被选中 0代表不选中 1代表选中

  /*
  * 首页左边导航的构造器 这边的json串是标准json串 所以用了Builder 返回标准json
  * */
  public TreeNode(Integer id, Integer parentId, String title, String icon, String href, Boolean spread) {
    this.id = id;
    this.parentId = parentId;
    this.title = title;
    this.icon = icon;
    this.href = href;
    this.spread = spread;
  }

  /***
    *@Description: 部门管理中的dtree的json
     * @param id
   * @param pid
   * @param title
   * @param spread
    * @return: null
    **/
  public TreeNode(Integer id, Integer parentId, String title, Boolean spread) {
    this.id = id;
    this.parentId = parentId;
    this.title = title;
    this.spread = spread;
  }

  /****
    *@Description: 分配权限的复选树的构造器
     * @param id
   * @param parentId
   * @param title
   * @param spread
   * @param checkAttr
    * @return: null
    **/
  public TreeNode(Integer id, Integer parentId, String title, Boolean spread, String checkArr) {
    this.id = id;
    this.parentId = parentId;
    this.title = title;
    this.spread = spread;
    this.checkArr = checkArr;
  }
}
